<?php
Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Auth::routes();
});
Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
	Route::get('/', 'AdminController@index');
	Route::resource ('/adminuser','AdminUserController')->middleware('permission:admin,resource');
	Route::resource ('/role','RoleController')->middleware('permission:admin,resource');
	Route::get ('/showPermission/{roleid}','RoleController@showPermission')->name ('showPermission')->middleware('permission:admin');
	Route::post ('/permission/{roleid}','RoleController@permission')->name ('permission')->middleware('permission:admin');
	Route::get ('/showRole/{adminid}','AdminUserController@showRole')->name ('showRole')->middleware('permission:admin');
	Route::post('/assignRole/{adminid}','AdminUserController@assignRole')->name('assignRole')->middleware('permission:admin')->middleware('permission:admin');

});
 
//module-route
Route::group(['middleware' => ['web', 'auth:admin'],'prefix'=>'admin','namespace'=>"Modules\Admin\Http\Controllers"], 
function () {
    //Route::resource('module', 'ModuleController')->middleware("permission:admin,resource");
//模块列表路由
	Route::get ('/module','ModuleController@index')->name ('module');
//更新模块缓存路由
	Route::get ('/updateCache','ModuleController@updateCache')->name ('updateCache');
//设为默认模块路由
    Route::get('/setDefaultModule/{module}','ModuleController@setDefaultModule')->name('setDefaultModule');
//后台模板列表路由
    Route::get('/template','TemplateController@index')->name('template');
//设置默认模板路由
    Route::get('/setDefaultTemplate/{name}','TemplateController@setDefaultTemplate')->name('setDefaultTemplate');

});